<template>
	<view class="page">
		<pageTxt>
			<!--  v-model="dataList" @query="queryList" -->
			<z-paging ref="paging" refresher-only @onRefresh="onRefresh" :paging-style="{ 'background-color': '#f7f7f7', height: '100%', width: '100%' }">
				<!-- 头部 -->
				<template slot="top">
					<u-navbar title="项目详情" :autoBack="true" :fixed="false"></u-navbar>
					<view class="tab-box flex ac jb">
						<view class="u-tabs-box">
							<u-tabs
								:current="tabIndex"
								@click="tabClickFunc"
								:list="tablist"
								inactiveStyle="color: #919092;"
								activeStyle="color: #3B75FF;"
								:lineColor="tabIndex == '-1' ? '#ffffff' : '#3B75FF'"
							></u-tabs>
						</view>
						<view class="tabs-item" :class="tabIndex == '-1' ? 'tabs-item-active' : ''" @click="tabClickFunc({ index: '-1' })">历史记录</view>
					</view>
				</template>
				<!-- 内容 -->
				<view class="detail-content-box" v-if="dataObj">
					<!-- 基础信息 -->
					<template v-if="tabIndex == 0">
						<u-empty
							v-if="!$fieldShowFunc('12-jcxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-jcxx')">
							<view class="title">基础信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmmc')">
								<text class="txt">项目名称</text>
								<view class="content">
									{{ dataObj.basic_information.project_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmbh')">
								<text class="txt">项目编号</text>
								<view class="content">
									{{ dataObj.basic_information.project_number || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmpp')">
								<text class="txt">项目品牌</text>
								<view class="content">
									{{ dataObj.basic_information.brand_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmlx')">
								<text class="txt">项目类型</text>
								<view class="content">
									{{ dataObj.basic_information.store_type_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_kclx')">
								<text class="txt">勘场类型</text>
								<view class="content">
									<template v-if="dataObj.basic_information.survey_site == 1">无需勘场</template>
									<template v-if="dataObj.basic_information.survey_site == 2">实地勘场</template>
									<template v-if="dataObj.basic_information.survey_site == 3">勘场出图</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmmj')">
								<text class="txt">项目面积</text>
								<view class="content">
									{{ dataObj.basic_information.building_area ? dataObj.basic_information.building_area + '㎡' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmjd')">
								<text class="txt">项目进度</text>
								<view class="content">
									<template v-if="dataObj.basic_information.display_status == 10">项目待启动</template>
									<template v-if="dataObj.basic_information.display_status == 15">待勘场</template>
									<template v-if="dataObj.basic_information.display_status == 18">待勘场出图</template>
									<template v-if="dataObj.basic_information.display_status == 20">待方案设计</template>
									<template v-if="dataObj.basic_information.display_status == 25">待报价</template>
									<template v-if="dataObj.basic_information.display_status == 30">洽谈中</template>
									<template v-if="dataObj.basic_information.display_status == 40">已签约</template>
									<template v-if="dataObj.basic_information.display_status == 42">施工待启动</template>
									<template v-if="dataObj.basic_information.display_status == 45">施工中</template>
									<template v-if="dataObj.basic_information.display_status == 50">已完工</template>
									<template v-if="dataObj.basic_information.display_status == 55">待结算</template>
									<template v-if="dataObj.basic_information.display_status == 60">款项付清</template>
									<template v-if="dataObj.basic_information.display_status == 70">已取消</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmssq')">
								<text class="txt">省市区</text>
								<view class="content">
									{{ dataObj.basic_information.area || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xxdz')">
								<text class="txt">详细地址</text>
								<view class="content">
									{{ dataObj.basic_information.address || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmcjsj')">
								<text class="txt">项目创建时间</text>
								<view class="content">
									{{ dataObj.basic_information.created_at || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zxgtjd')">
								<text class="txt">最新沟通进度</text>
								<view class="content">
									{{ dataObj.basic_information.latest_communication_progress || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_dqjd')">
								<text class="txt">当前节点</text>
								<view class="content">
									{{ dataObj.basic_information.current_node || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zhpjpf')">
								<text class="txt">综合平均评分</text>
								<view class="content">
									{{ dataObj.basic_information.overall_rating ? dataObj.basic_information.overall_rating + '分' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qxrq')">
								<text class="txt">取消日期</text>
								<view class="content">
									{{ dataObj.basic_information.cancel_at || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qxlx')">
								<text class="txt">取消类型</text>
								<view class="content">
									<template v-if="dataObj.basic_information.cancel_type == 1">价格原因</template>
									<template v-if="dataObj.basic_information.cancel_type == 2">工期原因</template>
									<template v-if="dataObj.basic_information.cancel_type == 3">客户拒绝沟通</template>
									<template v-if="dataObj.basic_information.cancel_type == 4">客户自行施工</template>
									<template v-if="dataObj.basic_information.cancel_type == 5">不可抗力因素</template>
									<template v-if="dataObj.basic_information.cancel_type == 6">前施工问题影响</template>
									<template v-if="dataObj.basic_information.cancel_type == 7">客户失联</template>
									<template v-if="dataObj.basic_information.cancel_type == 8">其他原因</template>
									<template v-if="dataObj.basic_information.cancel_type == 0">--</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qxyyms')">
								<text class="txt">取消原因描述</text>
								<view class="content">
									{{ dataObj.basic_information.cancel_reason || '--' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 客户信息 -->
					<template v-if="tabIndex == 1">
						<u-empty
							v-if="!$fieldShowFunc('12-khxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-khxx')">
							<view class="title">客户信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_hybh')">
								<text class="txt">会员编号</text>
								<view class="content">
									<text
										v-if="$isPer(per_arr, ['projectDetail_khDetail'])"
										class="txt-btn"
										@click="jump('/pagesB/customerDetail/customerDetail?id=' + dataObj.customer.user_id)"
									>
										{{ dataObj.customer.member_id || '--' }}
									</text>
									<text v-else>{{ dataObj.customer.member_id || '--' }}</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_khlx')">
								<text class="txt">客户类型</text>
								<view class="content">
									<template v-if="dataObj.customer.customer_type == 0">--</template>
									<template v-if="dataObj.customer.customer_type == 1">VIP客户</template>
									<template v-if="dataObj.customer.customer_type == 2">优质客户</template>
									<template v-if="dataObj.customer.customer_type == 3">普通老客户</template>
									<template v-if="dataObj.customer.customer_type == 4">优质新客户</template>
									<template v-if="dataObj.customer.customer_type == 5">普通新客户</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_khmc')">
								<text class="txt">客户名称</text>
								<view class="content">
									{{ dataObj.customer.name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_lxfs')">
								<text class="txt">联系方式</text>
								<view class="content" @click="$callPhone(dataObj.customer.phone)">
									<text class="iconfont icon-dianhua"></text>
									{{ dataObj.customer.phone || '--' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 人员信息 -->
					<template v-if="tabIndex == 2">
						<u-empty
							v-if="!$fieldShowFunc('12-ryxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-ryxx')">
							<view class="title">人员信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_ppjl')">
								<text class="txt">品牌经理</text>
								<view class="content">
									{{ dataObj.personnel.channel_manager_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_khjl')">
								<text class="txt">客户经理</text>
								<view class="content">
									{{ dataObj.personnel.account_manager_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_kcgcjl')">
								<text class="txt">勘场工程经理</text>
								<view class="content">
									{{ dataObj.personnel.site_surveyors_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sggcjl')">
								<text class="txt">施工工程经理</text>
								<view class="content">
									{{ dataObj.personnel.engineering_manager_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sggz')">
								<text class="txt">施工工长</text>
								<view class="content">
									{{ dataObj.personnel.foreman_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_gcjl')">
								<text class="txt">工程监理</text>
								<view class="content">
									{{ dataObj.personnel.engineering_supervision_name || '--' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 报价信息 -->
					<template v-if="tabIndex == 3">
						<u-empty
							v-if="!$fieldShowFunc('12-bjxx') && !$fieldShowFunc('12-sjtz')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-bjxx') || $fieldShowFunc('12-sjtz')">
							<view class="title" v-if="$fieldShowFunc('12-bjxx')">报价信息</view>
							<template v-if="$fieldShowFunc('12-bjxx')">
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_bjbh')">
									<text class="txt">报价编号</text>
									<view class="content">
										<text
											v-if="dataObj.quotation.quotation_number"
											class="txt-btn"
											@click="jump('/pagesB/budgetManagementDetail/budgetManagementDetail?id=' + dataNew.id)"
										>
											{{ dataObj.quotation.quotation_number }}
										</text>
										<text v-else>--</text>
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_scdkbjsj')">
									<text class="txt">首次对客报价时间</text>
									<view class="content">
										{{ dataObj.quotation.first_quotation_date || '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zzdkbjsj')">
									<text class="txt">最终对客报价时间</text>
									<view class="content">
										{{ dataObj.quotation.last_quotation_date || '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_dkbjsj')">
									<text class="txt">对客报价时间</text>
									<view class="content">
										{{ dataObj.quotation.to_customer_quotation_date || '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_scbjje')">
									<text class="txt">首次报价金额</text>
									<view class="content">
										{{ dataObj.quotation.first_quotation_amount + '' ? dataObj.quotation.first_quotation_amount + '元' : '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zzbjje')">
									<text class="txt">最终报价金额</text>
									<view class="content">
										{{ dataObj.quotation.last_quotation_amount + '' ? dataObj.quotation.last_quotation_amount + '元' : '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zjxje')">
									<text class="txt">增减项金额</text>
									<view class="content">
										{{ dataObj.quotation.change_amount + '' ? dataObj.quotation.change_amount + '元' : '--' }}
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zjxywc')">
									<text class="txt">增减项已完成</text>
									<view class="content flex ac">
										<text
											v-if="$isPer(per_arr, ['projectDetail_zjxList'])"
											@click="navTochangeFunc(dataObj.quotation.change_items_completed_num)"
											:class="dataObj.quotation.change_items_completed_num ? 'txt-btn' : ''"
										>
											{{ dataObj.quotation.change_items_completed_num }}项
										</text>
										<text v-else>{{ dataObj.quotation.change_items_completed_num }}项</text>
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_zjxwwc')">
									<text class="txt">增减项未完成</text>
									<view class="content flex ac">
										<text
											v-if="$isPer(per_arr, ['projectDetail_zjxList'])"
											@click="navTochangeFunc(dataObj.quotation.change_items_incomplete_num)"
											:class="dataObj.quotation.change_items_incomplete_num ? 'txt-btn' : ''"
										>
											{{ dataObj.quotation.change_items_incomplete_num }}项
										</text>
										<text v-else>{{ dataObj.quotation.change_items_incomplete_num }}项</text>
									</view>
								</view>
							</template>
							<view
								class="item-box-item2 flex ac jb"
								v-if="$fieldShowFunc('12-sjtz')"
								@click="showFile = !showFile"
								:style="!$fieldShowFunc('12-bjxx') ? 'border:none;padding-top:0;' : ''"
							>
								<text>设计图纸</text>
								<u-icon :name="showFile ? 'arrow-up' : 'arrow-down'" color="#1B2431"></u-icon>
							</view>
							<template v-if="showFile">
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_pmtwj')">
									<text class="txt">平面图文件</text>
									<view class="content flex ac flex" v-if="dataObj.quotation.design_drawings.plan_drawing.length">
										<image
											v-for="(item, index) in dataObj.quotation.design_drawings.plan_drawing"
											:src="$fileImgFunc(item)"
											@click="previewFunc(item)"
											:key="index"
											mode="aspectFill"
											class="img-box"
										></image>
									</view>
									<view class="content flex ac flex" v-else>--</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xgtwj')">
									<text class="txt">效果图文件</text>
									<view class="content flex ac flex" v-if="dataObj.quotation.design_drawings.effect_drawing.length">
										<image
											v-for="(item, index) in dataObj.quotation.design_drawings.effect_drawing"
											:key="index"
											:src="$fileImgFunc(item)"
											@click="previewFunc(item)"
											mode="aspectFill"
											class="img-box"
										></image>
									</view>
									<view class="content flex ac flex" v-else>--</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sgtwj')">
									<text class="txt">施工图文件</text>
									<view class="content flex ac flex" v-if="dataObj.quotation.design_drawings.construction_drawing">
										<image
											v-for="(item, index) in dataObj.quotation.design_drawings.construction_drawing"
											:key="index"
											:src="$fileImgFunc(item)"
											@click="previewFunc(item)"
											mode="aspectFill"
											class="img-box"
										></image>
									</view>
									<view v-else class="content flex ac flex">--</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qtwj')">
									<text class="txt">其他文件</text>
									<view class="content flex ac flex" v-if="dataObj.quotation.design_drawings.other_file.length">
										<image
											v-for="(item, index) in dataObj.quotation.design_drawings.other_file"
											:key="index"
											:src="$fileImgFunc(item)"
											@click="previewFunc(item)"
											mode="aspectFill"
											class="img-box"
										></image>
									</view>
									<view class="content flex ac flex" v-else>--</view>
								</view>
							</template>
						</view>
					</template>
					<!-- 合同信息 -->
					<template v-if="tabIndex == 4">
						<u-empty
							v-if="!$fieldShowFunc('12-htxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-htxx')">
							<view class="title">合同信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htbh')">
								<text class="txt">合同编号</text>
								<view class="content">
									<span
										v-if="dataObj.contract.contract_number"
										class="txt-btn"
										@click="jump('/pagesB/contractDetail/contractDetail?id=' + dataObj.contract.contract_id)"
									>
										{{ dataObj.contract.contract_number }}
									</span>
									<span v-else>--</span>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htzt')">
								<text class="txt">合同状态</text>
								<view class="content">
									{{ dataObj.contract.contract_status ? (dataObj.contract.contract_status == 1 ? '已签约' : '已作废') : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htkgrq')">
								<text class="txt">合同开工日期</text>
								<view class="content">
									{{ dataObj.contract.contract_commencement_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htwgrq')">
								<text class="txt">合同完工日期</text>
								<view class="content">
									{{ dataObj.contract.contract_completion_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htgq')">
								<text class="txt">合同工期</text>
								<view class="content">
									{{ dataObj.contract.contract_duration_days ? dataObj.contract.contract_duration_days + '天' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_htqyje')">
								<text class="txt">合同签约金额</text>
								<view class="content">
									{{ dataObj.contract.contract_price ? dataObj.contract.contract_price + '元' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qybjb')">
								<text class="txt">签约报价比</text>
								<view class="content">
									{{ dataObj.contract.contract_quotation_ratio ? dataObj.contract.contract_quotation_ratio + '%' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qylrl')">
								<text class="txt">签约利润率</text>
								<view class="content">
									{{ dataObj.contract.contract_profit_margin ? dataObj.contract.contract_profit_margin.toFixed(2) + '%' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_qybz')">
								<text class="txt">签约备注</text>
								<view class="content">
									{{ dataObj.contract.remark || '--' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 施工信息 -->
					<template v-if="tabIndex == 5">
						<u-empty
							v-if="!$fieldShowFunc('12-sgxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-sgxx')">
							<view class="title">施工信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sgjd')">
								<text class="txt">施工进度</text>
								<view class="content">
									<template v-if="dataObj.construction.construction_status == 42 || dataObj.construction.construction_status == 40">待进场</template>
									<template v-if="dataObj.construction.construction_status == 45">施工中</template>
									<template v-if="dataObj.construction.construction_status == 50">已完工</template>
									<template v-if="dataObj.construction.construction_status == 60">质保中</template>
									<template v-if="dataObj.construction.construction_status == 70">质保到期</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_ysjd')">
								<text class="txt">验收进度</text>
								<view class="content">
									{{ dataObj.construction.acceptance_progress || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sjkgrq')">
								<text class="txt">实际开工日期</text>
								<view class="content">
									{{ dataObj.construction.on_site_start_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sjwgrq')">
								<text class="txt">实际完工日期</text>
								<view class="content">
									{{ dataObj.construction.actual_completion_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_dqsjgq')">
								<text class="txt">当前/实际工期</text>
								<view class="content">
									{{ dataObj.construction.construction_period ? dataObj.construction.construction_period + '天' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_swwcsj')">
								<text class="txt">收尾完成时间</text>
								<view class="content">
									{{ dataObj.construction.closeout_complete_date ? dataObj.construction.closeout_complete_date : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_fxbq')">
								<text class="txt">风险标签</text>
								<view class="content">
									{{ dataObj.construction.risk_label || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_yzg')">
								<text class="txt">已整改</text>
								<view class="content">
									<text v-if="$isPer(per_arr, ['projectDetail_zgdList'])" :class="dataObj.construction.rectified > 0 ? 'txt-btn' : ''" @click="jump2('zg')">
										{{ dataObj.construction.rectified + '项' }}
									</text>
									<text v-else>{{ dataObj.construction.rectified + '项' }}</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_wzg')">
								<text class="txt">未整改</text>
								<view class="content">
									<text v-if="$isPer(per_arr, ['projectDetail_zgdList'])" :class="dataObj.construction.not_rectified > 0 ? 'txt-btn' : ''" @click="jump2('nzg')">
										{{ dataObj.construction.not_rectified + '项' }}
									</text>
									<text v-else>{{ dataObj.construction.not_rectified + '项' }}</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmzlpf')">
								<text class="txt">项目质量评分</text>
								<view class="content">
									{{ dataObj.construction.project_quality_rating ? dataObj.construction.project_quality_rating + '分' : '--' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 结算信息 -->
					<template v-if="tabIndex == 6">
						<u-empty
							v-if="!$fieldShowFunc('12-jsxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-jsxx')">
							<view class="title">结算信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_jsbh')">
								<text class="txt">结算编号</text>
								<view class="content">
									<span
										v-if="dataObj.settlement.settlement_number"
										class="click-color"
										@click="jump('/pagesB/settlementManagementDetail/settlementManagementDetail?id=' + dataNew.id)"
									>
										{{ dataObj.settlement.settlement_number }}
									</span>
									<span v-else>--</span>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_cjjsdsj')">
								<text class="txt">出具结算时间</text>
								<view class="content">
									{{ dataObj.settlement.settlement_start_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_yjsje')">
								<text class="txt">应结算金额</text>
								<view class="content">
									{{ dataObj.settlement.settlement_amount ? dataObj.settlement.settlement_amount + '元' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sjjsje')">
								<text class="txt">实际结算金额</text>
								<view class="content">
									{{ dataObj.settlement.final_settlement_amount ? dataObj.settlement.final_settlement_amount + '元' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_jsyhje')">
								<text class="txt">结算优惠金额</text>
								<view class="content">
									{{ dataObj.settlement.settlement_discount_amount ? dataObj.settlement.settlement_discount_amount + '元' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_jswcsj')">
								<text class="txt">结算完成时间</text>
								<view class="content">
									{{ dataObj.settlement.settlement_completion_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_jssx')">
								<text class="txt">结算时效</text>
								<view class="content">
									{{ dataObj.settlement.settlement_validity ? dataObj.settlement.settlement_validity + '天' : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_jsbz')">
								<text class="txt">结算备注</text>
								<view class="content">
									{{ dataObj.settlement.settlement_remark || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmysk')">
								<text class="txt">项目已收款</text>
								<view class="content">
									<text v-if="$isPer(per_arr, ['loock_payLog'])" :class="dataObj.settlement.paid_amount > 0 ? 'txt-btn' : ''" @click="jump2('ysk')">
										{{ dataObj.settlement.paid_amount + '元' }}
									</text>
									<text v-else>{{ dataObj.settlement.paid_amount + '元' }}</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_xmwsk')">
								<text class="txt">项目未收款</text>
								<view class="content">
									{{ dataObj.settlement.unpaid_amount + '元' }}
								</view>
							</view>
						</view>
					</template>
					<!-- 售后信息 -->
					<template v-if="tabIndex == 7">
						<u-empty
							v-if="!$fieldShowFunc('12-shxx')"
							marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
							text=" "
						></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('12-shxx')">
							<view class="title">售后信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_shjzrq')">
								<text class="txt">售后截止日期</text>
								<view class="content flex ac">
									{{ dataObj.after_sales.warranty_deadline_date || '--' }}
									<picker
										mode="date"
										:value="pickerVal"
										@change="dateFunc"
										v-if="dataObj.after_sales.warranty_deadline_date && $isPer(per_arr, ['change_after_time'])"
									>
										<text class="txt-btn" style="margin-left: 10rpx">修改</text>
									</picker>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_sfzzbqn')">
								<text class="txt">是否在质保期内</text>
								<view class="content">
									{{ dataObj.basic_information.status >= 1150 ? (dataObj.after_sales.is_sell_by == 1 ? '是' : '否') : '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_shywc')">
								<text class="txt">售后已完成</text>
								<view class="content">
									<text v-if="$isPer(per_arr, ['projectDetail_shList'])" :class="dataObj.after_sales.completed > 0 ? 'txt-btn' : ''" @click="jump2('sh')">
										{{ dataObj.after_sales.completed }}次
									</text>
									<text v-else>{{ dataObj.after_sales.completed }}次</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('xm_shwwc')">
								<text class="txt">售后未完成</text>
								<view class="content">
									<text v-if="$isPer(per_arr, ['projectDetail_shList'])" :class="dataObj.after_sales.not_finished > 0 ? 'txt-btn' : ''" @click="jump2('nsh')">
										{{ dataObj.after_sales.not_finished }}次
									</text>
									<text v-else>{{ dataObj.after_sales.not_finished }}次</text>
								</view>
							</view>
						</view>
					</template>
					<!-- 历史记录 -->
					<template v-if="tabIndex == -1">
						<view class="item-box">
							<logListCom :logList="logList"></logListCom>
						</view>
					</template>
				</view>
				<view class="bottom-btn-box flex ac jb" slot="bottom">
					<view style="width: 100%" v-if="!loading">
						<judgeBtn info :per_arr="per_arr" :btns="btns" objectType="project" :state="dataNew.status" :item="dataNew" @change="btnsChange"></judgeBtn>
					</view>
				</view>
			</z-paging>
		</pageTxt>
		<!-- 文件预览 -->
		<preFileCom :fileObj="fileObj" @onFileSuccess="fileObj = ''"></preFileCom>
		<!-- 操作组件 -->
		<projectOperate :value.sync="per_name" :oper_item="oper_item" @submit="handleSubmit"></projectOperate>
	</view>
</template>

<script>
import logListCom from '../components/logListCom/logListCom.vue';
export default {
	components: {
		logListCom
	},
	provide() {
		return {
			providedData: this.btns
		};
	},
	data() {
		return {
			fileObj: '',
			showFile: true,
			loading: false,
			dataObj: '',
			tabIndex: 0,
			tablist: [
				{
					name: '基础信息'
				},
				{
					name: '客户信息'
				},
				{
					name: '人员信息'
				},
				{
					name: '报价信息'
				},
				{
					name: '合同信息'
				},
				{
					name: '施工信息'
				},
				{
					name: '结算信息'
				},
				{
					name: '售后信息'
				}
			],
			logList: [],
			per_arr: [], //权限列表
			// 操作按钮
			btns: [
				{
					per_name: 'projects_chooseSurveySite',
					state: 1010,
					name: '项目启动'
				},
				{
					per_name: 'projects_confirmIsChangeItem',
					state: 1125,
					name: '发起结算单'
				},
				{
					per_name: 'projects_assignAccountManager',
					state: 1000,
					name: '分配客户经理'
				},
				{
					per_name: 'project_sqbj',
					state: 1065,
					name: '申请报价'
				},
				{
					per_name: 'project_dkbj',
					state: 1095,
					name: '对客报价'
				},
				{
					per_name: 'projects_updProject',
					func: (item) => {
						if (item.status > 1000) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目完善'
				},
				{
					per_name: 'projects_reQuote',
					func: (item) => {
						if (item.status == 1095 || item.status == 1100) {
							return true;
						} else {
							return false;
						}
					},
					name: '重新报价'
				},
				{
					per_name: 'projects_reSettlement',
					func: (item) => {
						if (item.status == 1140 || item.status == 1145) {
							return true;
						} else {
							return false;
						}
					},
					name: '重新结算'
				},
				{
					per_name: 'common_updProjectLeader',
					func: (item) => {
						if (item.account_manager_name && item.status != 1150) {
							return true;
						} else {
							return false;
						}
					},
					name: '更换客户经理'
				},
				{
					per_name: 'projects_projectRollback',
					func: (item) => {
						if (item.status != 1500 || item.status != 1150) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目回退'
				},
				{
					per_name: 'projects_projectCancellation',
					func: (item) => {
						if (item.status != 1500) {
							return true;
						} else {
							return false;
						}
					},
					name: '项目取消'
				},
				{
					per_name: 'projects_delProject',
					state: 1500,
					name: '删除'
				}
			],
			// 操作相关
			per_name: '',
			oper_item: {},
			dataNew: '',
			pickerVal: '' //售后截止日期 修改弹窗显示的日期
		};
	},
	onLoad(option) {
		this.getProjectDetails(option.id);
		this.getProjectDetailsNew(option.id);
		// 获取权限
		this.$Api
			.getHtmlAuthority({
				path: '/projectManagement'
			})
			.then((res) => {
				console.log(res, 'getHtmlAuthority');
				if (res.code == 200) {
					this.per_arr = res.data.permission;
				}
			});
	},
	onShow() {
		if (this.dataObj) {
			this.getProjectDetails(this.dataObj.basic_information.id);
			this.getProjectDetailsNew(this.dataObj.basic_information.id);
		}
	},
	methods: {
		// 基础详情
		getProjectDetailsNew(project_id) {
			this.$Apipc
				.getProjectDetails({
					project_id
				})
				.then((res) => {
					console.log(res, '项目详情new');
					if (res.code == 200) {
						res.data.user_name = res.data.customer_name;
						this.dataNew = res.data;
					}
				});
		},
		// 操作反馈
		handleSubmit(e) {
			if (e == 'projects_delProject') {
				setTimeout(() => {
					uni.navigateBack();
				}, 500);
				var pages = getCurrentPages();
				var perPage = pages[pages.length - 2];
				if (perPage && perPage.route == 'pagesA/saleManagement/saleManagement') {
					perPage.$vm.$refs.projectManagement.searchFunc();
				}
				return;
			}
			if (this.dataObj) {
				this.getProjectDetails(this.dataObj.basic_information.id);
				this.getProjectDetailsNew(this.dataObj.basic_information.id);
			}
		},
		// 操作事件
		btnsChange(e) {
			console.log(e);
			this.per_name = e.per_name;
			this.oper_item = e.item;
		},
		onRefresh() {
			if (this.tabIndex == -1) {
				this.getProjectLog();
			} else {
				this.getProjectDetails(this.dataObj.basic_information.id);
				this.getProjectDetailsNew(this.dataObj.basic_information.id);
			}
			this.$refs.paging.complete();
		},
		tabClickFunc(e) {
			if (e.index == -1) {
				this.getProjectLog();
			}
			this.tabIndex = e.index;
		},
		// 项目详情
		getProjectDetails(project_id) {
			this.loading = true;
			this.$Apipc
				.saleProjectDetails({
					project_id
				})
				.then((res) => {
					console.log(res, '项目详情');
					this.loading = false;
					if (res.code == 200) {
						this.dataObj = res.data;
						this.pickerVal = res.data.after_sales.warranty_deadline_date;
					}
				});
		},
		// 预览
		previewFunc(item) {
			this.fileObj = item;
		},
		getProjectLog() {
			console.log(this.dataObj);
			uni.showLoading({
				mask: true
			});
			this.$Apipc
				.getProjectLog({
					project_id: this.dataObj.basic_information.id,
					log_status: [100, 110, 120, 130, 140, 180, 200, 240, 250, 280, 310, 340, 362, 366, 370, 460, 450, 480, 410, 413, 415, 420, 440]
				})
				.then((res) => {
					uni.hideLoading();
					console.log(res, '项目日志列表');
					if (res.code == 200) {
						res.data.forEach((item) => {
							if (item.form_data) {
								item.form_data = JSON.parse(item.form_data);
							}
						});
						this.logList = res.data;
					}
				});
		},
		// 查看增减项
		navTochangeFunc(num) {
			if (!num) return;
			uni.navigateTo({
				url: '/pagesA/preSettlementManagement/preSettlementManagement?project_name=' + this.dataObj.basic_information.project_name + '&tabIndex=3'
			});
		},

		jump(path) {
			uni.navigateTo({
				url: path
			});
		},
		jump2(type) {
			switch (type) {
				case 'zg':
					if (this.dataObj.construction.rectified > 0) {
						uni.navigateTo({
							url: `/pagesA/engineeringManagement/engineeringManagement?tabIndex=4&project_name=${this.dataNew.project_name}&rectification_status=30`
						});
					}
					break;
				case 'nzg':
					if (this.dataObj.construction.not_rectified > 0) {
						uni.navigateTo({
							url: `/pagesA/engineeringManagement/engineeringManagement?tabIndex=4&project_name=${this.dataNew.project_name}&rectification_status=40`
						});
					}
					break;
				case 'ysk':
					if (this.dataObj.settlement.paid_amount > 0) {
						uni.navigateTo({
							url: `/pagesA/financialManagement/financialManagement?tabIndex=0&project_name=${this.dataNew.project_name}`
						});
					}
					break;
				case 'sh':
					if (this.dataObj.after_sales.completed > 0) {
						uni.navigateTo({
							url: `/pagesA/engineeringManagement/engineeringManagement?tabIndex=5&project_name=${this.dataNew.project_name}&after_status=3`
						});
					}
					break;
				case 'nsh':
					if (this.dataObj.after_sales.not_finished > 0) {
						uni.navigateTo({
							url: `/pagesA/engineeringManagement/engineeringManagement?tabIndex=5&project_name=${this.dataNew.project_name}&after_status=4`
						});
					}
					break;
			}
		},
		// 修改售后截止日期
		dateFunc(e) {
			if (this.dataObj.after_sales.warranty_deadline_date === e.detail.value) {
				uni.showToast({
					title: '日期未修改，无需提交',
					icon: 'error'
				});
				return;
			}
			uni.showLoading({
				mask: true
			});
			this.$Apipc
				.updWarrantyDate({
					project_id: this.dataObj.basic_information.id,
					warranty_deadline_date: e.detail.value
				})
				.then((res) => {
					uni.hideLoading();
					if (res.code == 200) {
						this.getProjectDetails(this.dataObj.basic_information.id);
						this.getProjectDetailsNew(this.dataObj.basic_information.id);
					}
					uni.showToast({
						title: res.message,
						icon: res.code == 200 ? 'success' : 'error'
					});
				});
		}
	}
};
</script>

<style lang="scss" scoped>
@import 'projectDetail.scss';
</style>
